<template>
  <div >
    <div class="pgbanner">
      <img :src="list.img" alt="" mode="widthFix">
    </div>
    <div class="pgtitle2" style="padding-left: 0;color: #333333;">
      {{list.name}}
    </div>
    <div style="width: 90%;margin:0 auto;">
      <div class="small">{{list.time}}</div>
      <div class="content" v-html="list.info">
      </div>
    </div>
  </div>
</template>


<script>
  export default{
    data(){
      return{
        list:[]
      }
    },
    components: {

    },
    methods:{
      requestData(id){
        var that=this;
        var api='https://eztw.com.cn/xcxread312/'+id;
        wx.request({
          url: api,
          header: {
            'content-type': 'application/json' // 默认值
          },
          success: function(res) {
            wx.hideNavigationBarLoading()
            var htmlContent = res.data.info
            console.log('htmlContent')
            res.data.info = htmlContent.replace(/(\<img|\<p)/gi, function ($0, $1) {
              return {
                '<img': '<img style="max-width:100%; display:inherit;height:auto" ',
                '<p': '<p style="margin-bottom: 0px;" ',
              }[$1]
            })
            that.list=res.data;
            console.log(that.list);
            wx.setNavigationBarTitle({  title: res.data.name})
          }
        })

      }
    },
    onLoad: function(options) {
      var id=options.id;
      this.requestData(id);
      wx.showNavigationBarLoading();
    },
    onShow () {

    }
  }
</script>

<style>

  .content {
    line-height:2;
    width: 90%;
    margin:0 auto;
  }
  .small{
    font-size: 14px;
    color: #bfbdbd;
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
  }
.pgbanner img{
  width: 100%;
}
</style>
